﻿using SSPivot.AspNetCore.Abstractions.Data;
using SSPivot.Common.Interface;

namespace SSPivot.Admin.Host.Core.Migrators
{
    public class SSPivotDataSeederContributor : IDataSeedContributor, ITransientDependency
    {
        public SSPivotDataSeederContributor(
           //ITaxReportRepository<admin_user> adminUserRepository,
           //ITaxReportRepository<admin_department> adminDepartmentRepository,
           //ITaxReportRepository<admin_menu> adminMenuRepository,
           //ITaxReportRepository<admin_role> adminRoleRepository
           )
        {
            //_adminUserRepository = adminUserRepository;
            //_adminMenuRepository = adminMenuRepository;
            //_adminDepartmentRepository = adminDepartmentRepository;
            //_adminRoleRepository = adminRoleRepository;
        }

        public async Task SeedAsync()
        {
            //if (_adminUserRepository.Query().Count() <= 0)
            //{
            //    using (TransactionScope tran = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
            //    {
            //        #region menu
            //        await _adminMenuRepository.AddAsync(new admin_menu()
            //        {
            //            Id = 1649239638002,
            //            Name = "组织架构",
            //            Code = "org",
            //            MenuType = 0,
            //            Levels = 1,
            //            ParentIds = "[]",
            //            OpenType = OpenType.Component,
            //            Component = "org",
            //            Path = "org",
            //            Redirect = "/org",
            //            Invisible = false,
            //            Sort = 100,
            //            CreationTime = DateTime.Now,
            //            Creator = "admin",
            //            CreatorId = 1650525469005,
            //        });
            //        await _adminMenuRepository.AddAsync(new admin_menu()
            //        {
            //            Id = 1649297464001,
            //            Name = "管理员管理",
            //            Code = "adminuser",
            //            ParentId = 1649239638002,
            //            MenuType = MenuType.Menu,
            //            Levels = 2,
            //            ParentIds = "[],[1649239638002],",
            //            OpenType = OpenType.Component,
            //            Invisible = false,
            //            Component = "adminuser",
            //            Path = "adminuser",
            //            Sort = 100,
            //            CreationTime = DateTime.Now,
            //            Creator = "admin",
            //            CreatorId = 1650525469005,
            //        });
            //        await _adminMenuRepository.AddAsync(new admin_menu()
            //        {
            //            Id = 1649300802001,
            //            Name = "菜单管理",
            //            Code = "menu",
            //            MenuType = MenuType.Menu,
            //            Levels = 2,
            //            Invisible = false,
            //            ParentId = 1649239638002,
            //            ParentIds = "[],[1649239638002],",
            //            OpenType = OpenType.Component,
            //            Component = "menu",
            //            Path = "menu",
            //            Sort = 100,
            //            CreationTime = DateTime.Now,
            //            Creator = "admin",
            //            CreatorId = 1650525469005,
            //        });
            //        await _adminMenuRepository.AddAsync(new admin_menu()
            //        {
            //            Id = 1649301828001,
            //            Name = "公司部门",
            //            Code = "deprtment",
            //            MenuType = MenuType.Menu,
            //            Levels = 2,
            //            ParentId = 1649239638002,
            //            ParentIds = "[],[1649239638002],",
            //            OpenType = OpenType.Component,
            //            Invisible = false,
            //            Component = "deprtment",
            //            Path = "deprtment",
            //            Sort = 100,
            //            CreationTime = DateTime.Now,
            //            Creator = "admin",
            //            CreatorId = 1650525469005,
            //        });
            //        await _adminMenuRepository.AddAsync(new admin_menu()
            //        {
            //            Id = 1649301937003,
            //            Name = "角色管理",
            //            Code = "role",
            //            MenuType = MenuType.Menu,
            //            Invisible = false,
            //            Levels = 2,
            //            ParentId = 1649239638002,
            //            ParentIds = "[],[1649239638002],",
            //            OpenType = OpenType.Component,
            //            Component = "role",
            //            Path = "role",
            //            Sort = 100,
            //            CreationTime = DateTime.Now,
            //            Creator = "admin",
            //            CreatorId = 1650525469005,
            //        });
            //        await _adminMenuRepository.AddAsync(new admin_menu()
            //        {
            //            Id = 1650529653002,
            //            Name = "仪表盘",
            //            Code = "dashboard",
            //            Invisible = false,
            //            MenuType = 0,
            //            Levels = 1,
            //            ParentIds = "[],",
            //            OpenType = OpenType.Component,
            //            Component = "dashboard",
            //            Path = "dashboard",
            //            Redirect = "/dashboard",
            //            Sort = 100,
            //            CreationTime = DateTime.Now,
            //            Creator = "admin",
            //            CreatorId = 1650525469005,
            //        });
            //        await _adminMenuRepository.AddAsync(new admin_menu()
            //        {
            //            Id = 1650529690003,
            //            Name = "欢迎页",
            //            Code = "workplace",
            //            Invisible = false,
            //            MenuType = MenuType.Menu,
            //            Levels = 2,
            //            ParentId = 1650529653002,
            //            ParentIds = "[],[1650529653002],",
            //            OpenType = OpenType.Component,
            //            Component = "workplace",
            //            Path = "workplace",
            //            Sort = 100,
            //            CreationTime = DateTime.Now,
            //            Creator = "admin",
            //            CreatorId = 1650525469005,
            //        });
            //        await _adminMenuRepository.AddAsync(new admin_menu()
            //        {
            //            Id = 1650599133016,
            //            Name = "附件管理",
            //            Code = "attachment",
            //            Invisible = false,
            //            MenuType = MenuType.Menu,
            //            Levels = 2,
            //            ParentId = 1650599199017,
            //            ParentIds = "[],[1650599199017],",
            //            OpenType = OpenType.Component,
            //            Component = "attachment",
            //            Path = "attachment",
            //            Sort = 100,
            //            CreationTime = DateTime.Now,
            //            Creator = "admin",
            //            CreatorId = 1650525469005,
            //        });
            //        await _adminMenuRepository.AddAsync(new admin_menu()
            //        {
            //            Id = 1650599199017,
            //            Name = "系统管理",
            //            Code = "system",
            //            MenuType = MenuType.Catalogue,
            //            Levels = 1,
            //            Invisible = false,
            //            ParentIds = "[],",
            //            OpenType = OpenType.Component,
            //            Component = "system",
            //            Path = "system",
            //            Redirect = "/system",
            //            Sort = 100,
            //            CreationTime = DateTime.Now,
            //            Creator = "admin",
            //            CreatorId = 1650525469005,
            //        });
            //        await _adminMenuRepository.AddAsync(new admin_menu()
            //        {
            //            Id = 1650599252018,
            //            Name = "日志记录",
            //            Code = "log",
            //            MenuType = MenuType.Menu,
            //            Levels = 2,
            //            Invisible = false,
            //            ParentId = 1650599199017,
            //            ParentIds = "[],[1650599199017],",
            //            OpenType = OpenType.Component,
            //            Component = "log",
            //            Path = "log",
            //            Sort = 100,
            //            CreationTime = DateTime.Now,
            //            Creator = "admin",
            //            CreatorId = 1650525469005,
            //        });
            //        await _adminMenuRepository.AddAsync(new admin_menu()
            //        {
            //            Id = 1650599270019,
            //            Name = "登陆日志",
            //            Code = "loginlog",
            //            MenuType = MenuType.Menu,
            //            Invisible = false,
            //            Levels = 3,
            //            ParentId = 1650599252018,
            //            ParentIds = "[],[1650599199017][1650599252018],",
            //            OpenType = OpenType.Component,
            //            Component = "loginlog",
            //            Path = "loginlog",
            //            Sort = 100,
            //            CreationTime = DateTime.Now,
            //            Creator = "admin",
            //            CreatorId = 1650525469005,
            //        });
            //        await _adminMenuRepository.AddAsync(new admin_menu()
            //        {
            //            Id = 1650599289020,
            //            Name = "操作日志",
            //            Code = "opslog",
            //            Invisible = false,
            //            MenuType = MenuType.Menu,
            //            Levels = 3,
            //            ParentId = 1650599252018,
            //            ParentIds = "[],[1650599199017][1650599252018],",
            //            OpenType = OpenType.Component,
            //            Component = "opslog",
            //            Path = "opslog",

            //            Sort = 100,
            //            CreationTime = DateTime.Now,
            //            Creator = "admin",
            //            CreatorId = 1650525469005,
            //        });
            //        await _adminMenuRepository.AddAsync(new admin_menu()
            //        {
            //            Id = 1650767210002,
            //            Name = "异常日志",
            //            Code = "exlog",
            //            MenuType = MenuType.Menu,
            //            Levels = 3,
            //            ParentId = 1650599252018,
            //            ParentIds = "[],[1650599199017][1650599252018],",
            //            OpenType = OpenType.Component,
            //            Component = "exlog",
            //            Path = "exlog",
            //            Invisible = false,
            //            Sort = 100,
            //            CreationTime = DateTime.Now,
            //            Creator = "admin",
            //            CreatorId = 1650525469005,
            //        });
            //        await _adminMenuRepository.AddAsync(new admin_menu()
            //        {
            //            Id = 1650609746003,
            //            Name = "城市地区",
            //            Code = "city",
            //            MenuType = MenuType.Menu,
            //            Levels = 2,
            //            ParentId = 1650599199017,
            //            ParentIds = "[],[1650599199017],",
            //            OpenType = OpenType.Component,
            //            Invisible = false,
            //            Component = "city",
            //            Path = "city",
            //            Sort = 100,
            //            CreationTime = DateTime.Now,
            //            Creator = "admin",
            //            CreatorId = 1650525469005,
            //        });
            //        await _adminMenuRepository.AddAsync(new admin_menu()
            //        {
            //            Id = 1650620724002,
            //            Name = "短信记录",
            //            Code = "sms",
            //            MenuType = MenuType.Menu,
            //            Levels = 3,
            //            Invisible = false,
            //            ParentId = 1650599252018,
            //            ParentIds = "[],[1650599199017][1650599252018],",
            //            OpenType = OpenType.Component,
            //            Component = "sms",
            //            Path = "sms",
            //            Sort = 100,
            //            CreationTime = DateTime.Now,
            //            Creator = "admin",
            //            CreatorId = 1650525469005,
            //        });
            //        await _adminMenuRepository.AddAsync(new admin_menu()
            //        {
            //            Id = 1650620748004,
            //            Name = "配置管理",
            //            Code = "config",
            //            MenuType = MenuType.Menu,
            //            Invisible = false,
            //            Levels = 2,
            //            ParentId = 1650599199017,
            //            ParentIds = "[],[1650599199017],",
            //            OpenType = OpenType.Component,
            //            Component = "config",
            //            Path = "config",
            //            Sort = 100,
            //            CreationTime = DateTime.Now,
            //            Creator = "admin",
            //            CreatorId = 1650525469005,
            //        });
            //        #endregion

            //        #region role
            //        await _adminRoleRepository.AddAsync(new admin_role
            //        {
            //            Id = 1650506449005,
            //            Name = "开发者",
            //            Code = "dev",
            //            Sort = 1,
            //            RoleMenuScope = "[1650529653002,1650529690003,1649297464001,1649301828001,1650599199017,1649300802001,1649301937003,1650599133016,1650599252018,1650599270019,1650599289020,1650620724002,1650767210002,1650609746003,1650620748004,1649301895002,1649239638002]",
            //            DataPermissionType = RoleDataPermissionType.All,
            //            IsStatic = true,
            //            CreationTime = DateTime.Now,
            //            Creator = "admin",
            //            CreatorId = 1650525469005,
            //        });
            //        await _adminRoleRepository.AddAsync(new admin_role
            //        {
            //            Id = 1650511080002,
            //            Name = "管理员",
            //            Code = "admin",
            //            Sort = 2,
            //            RoleMenuScope = "[1650529653002,1650529690003,1649297464001,1649301828001,1649239638002]",
            //            DataPermissionType = RoleDataPermissionType.All,
            //            IsStatic = true,
            //            CreationTime = DateTime.Now,
            //            Creator = "admin",
            //            CreatorId = 1650525469005,
            //        });
            //        #endregion

            //        #region department
            //        await _adminDepartmentRepository.AddAsync(new admin_department()
            //        {
            //            Id = 1650504323004,
            //            Name = "河南广慧会计",
            //            Code = "ghkj",
            //            SimpleName = "广慧会计",
            //            Pids = "[]",
            //            Sort = 1,
            //            CreationTime = DateTime.Now,
            //            Creator = "admin",
            //            CreatorId = 1650525469005,
            //        });
            //        await _adminDepartmentRepository.AddAsync(new admin_department()
            //        {
            //            Id = 1650504795002,
            //            Name = "集团公司",
            //            Code = "ghkj-jtgs",
            //            SimpleName = "集团公司",
            //            ParentId = 1650504323004,
            //            Pids = "[1650504323004]",
            //            Sort = 2,
            //            CreationTime = DateTime.Now,
            //            Creator = "admin",
            //            CreatorId = 1650525469005,
            //        });
            //        #endregion

            //        #region adminuser
            //        await _adminUserRepository.AddAsync(new admin_user
            //        {
            //            Id = 1650525040002,
            //            LoginName = "xulong",
            //            Phone = "15738833876",
            //            NickName = "徐龙",
            //            Password = "5B896D6BA8D5CF1FAE4C7951FE7D4AE1",
            //            DepartmentId = 1650504323004,
            //            Salt = "c5azp",
            //            UserRoleScope = "[1650506449005,1650511080002]",
            //            Email = "zzxulong@qq.com",
            //            Gender = GenderType.Boy,
            //            LastLoginTime = DateTime.Now,
            //            CreationTime = DateTime.Now,
            //            Creator = "admin",
            //            CreatorId = 1650525469005,

            //        });
            //        await _adminUserRepository.AddAsync(new admin_user
            //        {
            //            Id = 1650525469005,
            //            LoginName = "admin",
            //            Phone = "13526901763",
            //            NickName = "admin",
            //            Password = "0FCE5A398C8DE205CFE8015DDC66E756",
            //            DepartmentId = 1650504795002,
            //            Salt = "3sy6w",
            //            UserRoleScope = "[1650511080002,1650506449005]",
            //            Email = "zzxulong@qq.com",
            //            Gender = GenderType.Boy,
            //            LastLoginTime = DateTime.Now,
            //            CreationTime = DateTime.Now,
            //            Creator = "admin",
            //            CreatorId = 1650525469005,

            //        });
            //        #endregion

            //        tran.Complete();
            //    }
            //}
        }
    }
}
